/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.can.be;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Jhosep
 */
@Entity
@Table(name = "CAN_PAIS")
@NamedQueries({@NamedQuery(name = "Pais.findAll", query = "SELECT p FROM Pais p"), @NamedQuery(name = "Pais.findByIdPais", query = "SELECT p FROM Pais p WHERE p.idPais = :idPais"), @NamedQuery(name = "Pais.findByNombrePais", query = "SELECT p FROM Pais p WHERE p.nombrePais = :nombrePais"), @NamedQuery(name = "Pais.findByDescripcionPais", query = "SELECT p FROM Pais p WHERE p.descripcionPais = :descripcionPais"), @NamedQuery(name = "Pais.findByCodigoPostalPais", query = "SELECT p FROM Pais p WHERE p.codigoPostalPais = :codigoPostalPais")})
public class Pais implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_PAIS", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idPais;
    @Column(name = "NOMBRE_PAIS", length = 50)
    private String nombrePais;
    @Column(name = "DESCRIPCION_PAIS", length = 250)
    private String descripcionPais;
    @Column(name = "CODIGO_POSTAL_PAIS", length = 10)
    private String codigoPostalPais;
    @OneToMany(mappedBy = "fidCanPais", fetch = FetchType.LAZY)
    private List<Ciudad> ciudadCollection;

    public Pais() {
    }

    public Pais(Long idPais) {
        this.idPais = idPais;
    }

    public Long getIdPais() {
        return idPais;
    }

    public void setIdPais(Long idPais) {
        this.idPais = idPais;
    }

    public String getNombrePais() {
        return nombrePais;
    }

    public void setNombrePais(String nombrePais) {
        this.nombrePais = nombrePais;
    }

    public String getDescripcionPais() {
        return descripcionPais;
    }

    public void setDescripcionPais(String descripcionPais) {
        this.descripcionPais = descripcionPais;
    }

    public String getCodigoPostalPais() {
        return codigoPostalPais;
    }

    public void setCodigoPostalPais(String codigoPostalPais) {
        this.codigoPostalPais = codigoPostalPais;
    }

    public List<Ciudad> getCiudadCollection() {
        return ciudadCollection;
    }

    public void setCiudadCollection(List<Ciudad> ciudadCollection) {
        this.ciudadCollection = ciudadCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPais != null ? idPais.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pais)) {
            return false;
        }
        Pais other = (Pais) object;
        if ((this.idPais == null && other.idPais != null) || (this.idPais != null && !this.idPais.equals(other.idPais))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.can.be.Pais[idPais=" + idPais + "]";
    }

}
